Options to patch

Contents|Index|Previous|Next

Options to patch

Here is a summary of all of the options that patch accepts. Older versions of patch do not accept long-named options or the '-t', '-E', or '-V' options.

Multiple single-letter options that do not take an argument can be combined into a single command line argument (with only one dash). Brackets ([ and ]) indicate that an option takes an optional argument.

'-b backup-suffix'
Use backup-suffix as the backup extension instead of '.orig' or '˜'. See Backup File Names .

'-B backup-prefix'
Use backup-prefix as a prefix to the backup file name. If this option is specified, any '-b' option is ignored. See Backup File Names.

'--batch'
Do not ask any questions. See Messages and Questions from patch.

'-c'
'--context'
Interpret the patch file as a context diff. See Selecting the patch Input Format.

'-d directory'
'--directory= directory'
Makes directory directory the current directory for interpreting both file names in the patch file, and file names given as arguments to other options. See Applying Patches in Other Directories.

'-D name'
Make merged if-then-else output using format. See Merging Files with If-then-else.

'--debug=number'
Set internal debugging flags. Of interest only to patch patchers.

'-e'
'--ed'
Interpret the patch file as an ed script. See Selecting the patch Input Format.

'-E'
Remove output files that are empty after the patches have been applied. See Removing Empty Files.

'-f'
Assume that the user knows exactly what he or she is doing, and ask no questions. See Messages and Questions from patch.

'-F lines'
Set the maximum fuzz factor to lines. See Helping patch Find Inexact Matches.

'--force'
Assume that the user knows exactly what he or she is doing, and ask no questions. See Messages and Questions from patch.

'--forward'
Ignore patches that patch thinks are reversed or already applied. See also '-R'. See Applying Reversed Patches.

'--fuzz=lines'
Set the maximum fuzz factor to lines. See Helping patch Find Inexact Matches.

'--help'
Print a summary of the options that patch recognizes, then exit.

'--ifdef= name'
Make merged if-then-else output using format. See Merging Files with If-then-else.

'--ignore-white-space'
'-l'
Let any sequence of white space in the patch file match any sequence of white space in the input file. See Applying Patches with Changed White Space.

'-n'
'--normal'
Interpret the patch file as a normal diff. See Selecting patch Input Format.

'-N'
Ignore patches that patch thinks are reversed or already applied. See also '-R'. See Applying Reversed Patches.

'-o output-file'
'--output=output-file'
Use output-file as the output file name. See Invoking patch.

'-p[number]'
Set the file name strip count to number. See Applying Patches in Other Directories.

'--prefix=backup-prefix'
Use backup-prefix as a prefix to the backup file name. If this option is specified, any '-b' option is ignored. See Backup File Names.

'--quiet'
Work silently unless an error occurs. See Messages and Questions from patch.

'-r reject-file'
Use reject-file as the reject file name. See Reject File Names.

'-R'
Assume that this patch was created with the old and new files swapped. See Applying Reversed Patches.

'--reject-file=reject-file'
Use reject-file as the reject file name. See Reject File Names.

'--remove-empty-files'
Remove output files that are empty after the patches have been applied. See Removing Empty Files.

'--reverse'
Assume that this patch was created with the old and new files swapped. See Applying Reversed Patches.

'-s'
Work silently unless an error occurs. See Messages and Questions from patch.

'-S'
Ignore this patch from the patch file, but continue looking for the next patch in the file. See Multiple Patches in a File.

'--silent'
Work silently unless an error occurs. See Messages and Questions from patch.

'--skip'
Ignore this patch from the patch file, but continue looking for the next patch in the file. See Multiple Patches in a File.

'--strip[=number]'
Set the file name strip count to number. See Applying Patches in Other Directories.

'--suffix=backup-suffix'
Use backup-suffix as the backup extension instead of '.orig' or '˜'. See Backup File Names.

'-t'
Do not ask any questions. See Messages and Questions from patch.

'-u'
'--unified'
Interpret the patch file as a unified diff. See Selecting the patch Input Format.

'-v'
Output the revision header and patch level of patch.

'-V backup-style'
Select the kind of backups to make. See Backup File Names.

'--version'
Output the revision header and patch level of patch, then exit.

'--version=control=backup-style'
Select the kind of backups to make. See Backup File Names.

'-x number'
Set internal debugging flags. Of interest only to patch patchers.